import h5 from './h5'
import mini from './mini'
import app from './app'
import mock from './mock'

let bridge = null
const ua = navigator.userAgent.toLowerCase()
if (ua.indexOf('html5plus') !== -1) {
    bridge = app
} else if (ua.indexOf('miniprogram') !== -1) {  // 要先判断小程序，因为小程序的ua也带micromessenger
    bridge = mini
} else if (ua.indexOf('micromessenger') !== -1) {
    bridge = h5
} else {
    bridge = mock
}

export default new bridge()
